//
//  NavigationController.swift
//  民生生活
//
//  Created by apple on 2017/8/4.
//  Copyright © 2017年 youjindi.app.com. All rights reserved.
//

import UIKit

class NavigationController: UINavigationController {

    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        setUpNavigationBarAppearance()

        if viewControllers.count > 0{
            viewController.hidesBottomBarWhenPushed = true
            viewController.fd_interactivePopMaxAllowedInitialDistanceToLeftEdge = ScreenWidth/3
        }
        super.pushViewController(viewController, animated: true)
    }
    
    override func popViewController(animated: Bool) -> UIViewController? {
        return super.popViewController(animated: true)
    }
    
    private func setUpNavigationBarAppearance() -> Void {
        UINavigationBar.appearance().tintColor = UIColor.white
        UINavigationBar.appearance().barTintColor = UIColor(red: 231.0/255.0, green: 95.0/255.0, blue: 53.0/255.0, alpha: 0.3)
        UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName:UIColor.white]
    }

}
